<%--
  Created by IntelliJ IDEA.
  User: 86131
  Date: 2023/9/28
  Time: 13:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath }"/>
<html>
<head>
    <title>网站后台管理模版</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="../../static/admin/css/admin.css" />
</head>
<body>
<div class="page-content-wrap">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-inline tool-btn">
                <button class="layui-btn layui-btn-small layui-btn-normal addBtn hidden-xs" data-url="menu-add2.jsp"><i class="layui-icon">&#xe654;</i></button>
                <button class="layui-btn layui-btn-small layui-btn-warm listOrderBtn hidden-xs" data-url="/admin/category/listorderall.jsp"><i class="iconfont">&#xe656;</i></button>
            </div>
            <div class="layui-inline">
                <input type="text" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input">
            </div>
            <button class="layui-btn layui-btn-normal" lay-submit="search">搜索</button>
        </div>
    </form>
    <div class="layui-form" id="table-list">
        <table class="layui-table" lay-even lay-skin="nob">
            <colgroup>
                <col width="50">
                <col class="hidden-xs" width="50">
                <col class="hidden-xs" width="100">
                <col>
                <col width="80">
                <col width="150">
            </colgroup>
            <thead>
            <tr>
                <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
                <th class="hidden-xs">ID</th>
                <th class="hidden-xs">排序</th>
                <th>影厅名称</th>
                <th>影院ID</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:set var="hallList" value="${sessionScope.hallList}"></c:set>
            <c:choose>
                <c:when test="${empty hallList || empty page}">
                    <script>window.location='${path}/servlet/cinemabackjsp/selHall'</script>
                </c:when>
                <c:otherwise>
                    <c:forEach var="hl" items="${hallList}">
                        <tr>
                            <td><input type="checkbox" name="" lay-skin="primary" data-id="1"></td>
                            <td class="hidden-xs">${hl.hallId}</td>
                            <td class="hidden-xs"><input type="text" name="title" autocomplete="off" class="layui-input" value="0" data-id="1"></td>
                            <td>${hl.hallName}</td>
                            <td>${hl.cinemaId}</td>
                            <td><button class="layui-btn layui-btn-mini layui-btn-normal table-list-status" data-status='1'>可用</button></td>
                            <td>
                                <div class="layui-inline">
                                    <button class="layui-btn layui-btn-mini layui-btn-normal  add-btn" data-id="1" data-url="menu-add2.jsp"><i class="layui-icon">&#xe654;</i></button>
                                    <button class="layui-btn layui-btn-mini layui-btn-normal  edit-btn" data-id="1" data-url="menu-add2.jsp"><i class="layui-icon">&#xe642;</i></button>
                                    <button class="layui-btn layui-btn-mini layui-btn-danger del-btn" data-id="1" data-url="del.jsp"><i class="layui-icon">&#xe640;</i></button>
                                </div>
                            </td>
                        </tr>
                    </c:forEach>
                </c:otherwise>
            </c:choose>
            </tbody>
        </table>
    </div>
    <div class="page-wrap">
        <ul class="pagination">
            <li class="disabled"><span>«</span></li>
            <li class="active"><span>1</span></li>
            <li>
                <a href="#">2</a>
            </li>
            <li>
                <a href="#">»</a>
            </li>
        </ul>
    </div>
</div>
<script src="../../static/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/admin/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['form', 'jquery', 'layer', 'dialog'], function() {
        var $ = layui.jquery;

        //修改状态
        $('#table-list').on('click', '.table-list-status', function() {
            var That = $(this);
            var status = That.attr('data-status');
            var id = That.parent().attr('data-id');
            if(status == 1) {
                That.removeClass('layui-btn-normal').addClass('layui-btn-warm').html('不可用').attr('data-status', 2);
            } else if(status == 2) {
                That.removeClass('layui-btn-warm').addClass('layui-btn-normal').html('可用').attr('data-status', 1);

            }
        })

    });
</script>
</body>
</html>
